package org.ysu.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.ysu.entity.Clue;
import org.ysu.entity.AdminClue;
import org.ysu.entity.Role;
import org.ysu.service.AdminClueService;
import org.ysu.service.AdminService;
import org.ysu.vo.AdminClueVO;
import org.ysu.vo.ResultVO;
import org.ysu.vo.RoleAdminVO;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 线索分配表 前端控制器
 * </p>
 *
 * @author CaoYuJia
 * @since 2024-08-21
 */
@RestController
@RequestMapping("/adminClue")
public class AdminClueController {

    @Resource
    AdminService adminService;

    @Resource
    AdminClueService adminClueService;

    @GetMapping("/getAdmin")
    ResultVO<AdminClueVO> getAdminList (Long clueId) {
        return ResultVO.success(new AdminClueVO(adminService.Verifier(), adminClueService.getByClueId(clueId)));
    }

    @PostMapping("/save")
    ResultVO<Boolean> save(Long clueId, Long[] adminIds) {
        return ResultVO.success(adminClueService.save(clueId, adminIds));
    }
    @GetMapping("/getClueListByAdminId")
    ResultVO<List<Clue>> getClueListByAdminId(Long adminId) {
        return ResultVO.success(adminClueService.getClueListByAdminId(adminId));
    }
}
